<!DOCTYPE html>
<html lang="en">
    <head>
        <!-- start: Meta -->
        <meta charset="utf-8">
        <!--<script src="<?php // echo $this->assetDir                                                                        ?>js/jquery-1.9.1.min.js"></script>-->
        <title><?php echo $this->pageTitle ?></title>
        <meta name="description" content="Shampoo Dashboard">
        <meta name="keyword" content="Shampoo ">
        <!-- end: Meta -->

        <!-- start: Mobile Specific -->
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <!-- end: Mobile Specific -->

        <!-- start: CSS -->
        <link href="<?php echo $this->assetDir ?>css/bootstrap.min.css" rel="stylesheet">
        <link href="<?php echo $this->assetDir ?>css/bootstrap-responsive.min.css" rel="stylesheet">
        <link href="<?php echo $this->assetDir ?>css/style.css" rel="stylesheet">
        <link href="<?php echo $this->assetDir ?>css/style-responsive.min.css" rel="stylesheet">
        <link href="<?php echo $this->assetDir ?>css/retina.css" rel="stylesheet">
        <link href="<?php echo $this->assetDir ?>css/fullcalendar.css" rel="stylesheet">
        <link href="<?php echo $this->assetDir ?>css/shampoo/order.css" rel="stylesheet">
        <link href="<?php echo $this->assetDir ?>css/fullcalendar.print.css" media='print' rel="stylesheet">
        <!-- end: CSS -->
        <?php Yii::app()->clientScript->registerCoreScript('jquery'); ?>
        <?php // Yii::app()->clientScript->registerScriptFile($this->assetDir.'js/fix.js'); ?>
        <!-- start: Favicon and Touch Icons -->
        <link rel="apple-touch-icon-precomposed" sizes="144x144" href="<?php echo $this->assetDir ?>ico/apple-touch-icon-144-precomposed.png">
        <link rel="apple-touch-icon-precomposed" sizes="114x114" href="<?php echo $this->assetDir ?>ico/apple-touch-icon-114-precomposed.png">
        <link rel="apple-touch-icon-precomposed" sizes="72x72" href="<?php echo $this->assetDir ?>ico/apple-touch-icon-72-precomposed.png">
        <link rel="apple-touch-icon-precomposed" href="<?php echo $this->assetDir ?>ico/apple-touch-icon-57-precomposed.png">
        <link rel="shortcut icon" href="<?php echo $this->assetDir ?>ico/favicon.ico">

        <link href="<?php echo $this->assetDir ?>css/shampoo/bootstrap-switch.css" rel="stylesheet">
        <!-- end: Favicon and Touch Icons -->	
        <link href="<?php echo $this->assetDir ?>css/shampoo/common.css" rel="stylesheet">

        <script>
            var menuActive = '<?php echo $this->menuActive ?>';
            var ASSET_DIR = '<?php echo $this->assetDir ?>';
        </script>
        <script src="<?php echo $this->assetDir ?>js/jquery-migrate-1.0.0.min.js"></script>	
        <script src="<?php echo $this->assetDir ?>js/jquery-ui-1.10.3.custom.min.js"></script>	
        <script src="<?php echo $this->assetDir ?>js/jquery.ui.touch-punch.js"></script>	
        <script src="<?php echo $this->assetDir ?>js/modernizr.js"></script>	
        <script src="<?php echo $this->assetDir ?>js/bootstrap.min.js"></script>	
        <script src="<?php echo $this->assetDir ?>js/jquery.cookie.js"></script>	
        <script src='<?php echo $this->assetDir ?>js/fullcalendar.js'></script>	
        <script src='<?php echo $this->assetDir ?>js/jquery.dataTables.min.js'></script>
        <script src="<?php echo $this->assetDir ?>js/excanvas.js"></script>
        <script src="<?php echo $this->assetDir ?>js/jquery.flot.js"></script>
        <script src="<?php echo $this->assetDir ?>js/jquery.flot.pie.js"></script>
        <script src="<?php echo $this->assetDir ?>js/jquery.flot.stack.js"></script>
        <script src="<?php echo $this->assetDir ?>js/jquery.flot.resize.min.js"></script>
        <script src="<?php echo $this->assetDir ?>js/jquery.flot.time.js"></script>

        <script src="<?php echo $this->assetDir ?>js/gauge.min.js"></script>
        <script src="<?php echo $this->assetDir ?>js/jquery.chosen.min.js"></script>	
        <script src="<?php echo $this->assetDir ?>js/jquery.uniform.min.js"></script>		
        <script src="<?php echo $this->assetDir ?>js/jquery.cleditor.min.js"></script>	
        <script src="<?php echo $this->assetDir ?>js/jquery.noty.js"></script>	
        <script src="<?php echo $this->assetDir ?>js/jquery.elfinder.min.js"></script>	
        <script src="<?php echo $this->assetDir ?>js/jquery.raty.min.js"></script>	
        <script src="<?php echo $this->assetDir ?>js/jquery.iphone.toggle.js"></script>	
        <script src="<?php echo $this->assetDir ?>js/jquery.uploadify-3.1.min.js"></script>	
        <script src="<?php echo $this->assetDir ?>js/jquery.gritter.min.js"></script>	
        <script src="<?php echo $this->assetDir ?>js/jquery.imagesloaded.js"></script>	
        <script src="<?php echo $this->assetDir ?>js/jquery.masonry.min.js"></script>	
        <script src="<?php echo $this->assetDir ?>js/jquery.knob.modified.js"></script>	
        <script src="<?php echo $this->assetDir ?>js/jquery.sparkline.min.js"></script>	
        <script src="<?php echo $this->assetDir ?>js/counter.min.js"></script>	
        <script src="<?php echo $this->assetDir ?>js/raphael.2.1.0.min.js"></script>
        <script src="<?php echo $this->assetDir ?>js/justgage.1.0.1.min.js"></script>	
        <script src="<?php echo $this->assetDir ?>js/jquery.autosize.min.js"></script>	
        <script src="<?php echo $this->assetDir ?>js/retina.js"></script>
        <script src="<?php echo $this->assetDir ?>js/jquery.placeholder.min.js"></script>
        <script src="<?php echo $this->assetDir ?>js/wizard.min.js"></script>
        <script src="<?php echo $this->assetDir ?>js/shampoo/core.custom.js"></script>	

        <script src="<?php echo $this->assetDir ?>js/shampoo/bootstrap-switch.js"></script>
        <script src="<?php echo $this->assetDir ?>js/shampoo/common.js"></script>
        <script src="<?php echo $this->assetDir ?>js/custom.js"></script>
        <script src="<?php echo $this->assetDir ?>js/shampoo/jquery.slimscroll.min.js"></script>
        <script src="<?php echo $this->assetDir ?>js/bindDelay.js"></script>
        <link rel="stylesheet" href="//code.jquery.com/ui/1.11.0/themes/smoothness/jquery-ui.css">
      	<!--<script src="//code.jquery.com/ui/1.11.0/jquery-ui.js"></script>-->
  
        <!--<script src="<?php echo $this->assetDir ?>js/charts.min.js"></script>-->
        <?php
        Yii::app()->clientScript->registerCssFile($this->assetDir . 'css/shampoo/appointment.css', 'print');
        ?>
        <?php
        Yii::app()->clientScript->registerScriptFile($this->assetDir . 'js/shampoo/bootstrap-datepicker.js');
        Yii::app()->clientScript->registerScriptFile($this->assetDir . 'js/shampoo/bootstrap-timepicker.min.js');
        ?>
    </head>

    <body>
        <!-- start: Header -->
        <div class="navbar">
            <div class="navbar-inner">
                <div class="container-fluid">
                    <a class="btn btn-navbar" data-toggle="collapse" data-target=".top-nav.nav-collapse,.sidebar-nav.nav-collapse">
                        <span class="icon-bar"></span>
                        <span class="icon-bar"></span>
                        <span class="icon-bar"></span>
                    </a>
                    <a id="main-menu-toggle" class="hidden-phone open"><i class="icon-reorder"></i></a>		
                    <div class="row-fluid">
                        <a class="brand span2" href="<?php echo Yii::app()->createUrl('site/index') ?>">
                            <img src="<?php echo $this->assetDir ?>img/logo_small.png" alt='Shampoo'>
                        </a>
                    </div>		
                    <!-- start: Header Menu -->
                    <div class="nav-no-collapse header-nav">
                        <ul class="nav pull-right">

                            <li class="dropdown">
                                <a class="btn account dropdown-toggle" data-toggle="dropdown" href="#">
                                    <div class="avatar">
                                        <img src="<?php echo @$this->user->getAvartBySize(30,30) ?>" alt="Avatar">
                                    </div>
                                    <div class="user">
                                        <span class="hello">Welcome!</span>
                                        <span class="name"><?php echo Yii::app()->user->name ?>
                                            <?php if($this->user->type==Users::TYPE_ADMIN) : ?>
                                            <?php echo $this->user->getBadgeMessage()?>
                                            <?php endif;?>
                                        </span>

                                    </div>
                                </a>
                                <ul class="dropdown-menu">
                                    <li class="dropdown-menu-title">
                                    </li>
                                    <li>

                                        <a href="<?php echo Yii::app()->createUrl('site/index') ?>">
                                            <i class="icon-dashboard"></i> Dashboard
                                        </a>
                                    </li>
                                    <?php if($this->user->type==Users::TYPE_ADMIN) : ?>
                                        <li>
                                            <a href="<?php echo url('contact/index') ?>">
                                                <i class="icon-envelope"></i> Inbox <?php echo $this->user->getBadgeMessage()?>
                                            </a>

                                        </li>
                                    <?php endif;?>
                                    <li>
                                        <?php $profile = $this->user->type == Users::TYPE_BUSINESS ? Yii::app()->createUrl('bizuser/edit', array('pk' => 'secret_key')) : Yii::app()->createUrl('profile/index'); ?>
                                        <a href="<?php echo $profile ?>">
                                            <i class="icon-user"></i> Profile
                                        </a>
                                    </li>

                                    <li>
                                        <a href="<?php echo Yii::app()->createUrl('site/logout') ?>">
                                            <i class="icon-off"></i> Logout
                                        </a>
                                    </li>
                                </ul>
                            </li>
                            <!-- end: User Dropdown -->
                        </ul>
                    </div>
                    <!-- end: Header Menu -->
                </div>
            </div>
        </div>
        <!-- start: Header -->
        <div class="container-fluid-full">
            <div class="row-fluid" style=" min-height: 818px;">
                <!-- start: Main Menu -->
                <div id="sidebar-left" class="span2">
                    <div class="row-fluid actions">
                        <input type="text" id="btn-search" onkeyup="loadCustomer();" 
                               class="search span12" placeholder="Search customer"
                               onblur="hideSuggestCustomer();">
                        <ul class="suggest-list-search"></ul>
                    </div>

                    <div class="nav-collapse sidebar-nav">
                        <ul class="nav nav-tabs nav-stacked main-menu">
                            <?php foreach ($this->sidebarMenu as $menu): ?>
                                <li>
                                    <a class="dropmenu" href="#">
                                        <i class="<?php echo $menu['icon'] ?>"></i>
                                        <span class="hidden-tablet"><?php echo $menu['label'] ?></span>
                                    </a>
                                    <ul>
                                        <?php foreach ($menu['items'] as $item): ?>
                                            <li>
                                                <a class="submenu" active="<?php echo $item['active'] ?>"
                                                   href="<?php echo $item['url'] ?>">
                                                    <i class="<?php echo $item['icon'] ?>"></i>
                                                    <span class="hidden-tablet"><?php echo $item['label'] ?></span>
                                                </a>
                                            </li>
                                        <?php endforeach; ?>                                        
                                    </ul>	
                                </li>
                            <?php endforeach; ?>                                                        
                        </ul>
                    </div>
                </div>
                <!-- end: Main Menu -->

                <!-- start: Content -->
                <div id="content" class="span10">

                    <?php echo $content; ?><!--/fluid-row-->

                </div>
                <!-- end: Content -->
            </div>

            <div class="clearfix"></div>
            <footer>
                <p>
                    <span style="text-align:left;float:left">&copy; 2014 <a href="http://shampoo.com.sg" alt="Shampoo">Shampoo</a></span>
                    <span class="hidden-phone" style="text-align:right;float:right">Powered by: <a href="#" alt="Dotsy Media">Dotsy Media</a></span>
                </p>
            </footer>
        </div><!--/.fluid-container-->
        <div id="loading">
            <div id="loading_content">
                <img src="<?php echo $this->assetDir ?>img/loading.gif"/>
                Loading ...
            </div>
        </div>
        <!-- start: JavaScript-->

        <script type="text/javascript">
            //            reset form value
            jQuery(document).ready(function() {
                jQuery('#btn-reset').off('click').click(function() {

                    jQuery('input.input-reset').attr('value', '');
                });
            });
        </script>

        <script>
            function deleteItem(el)
            {
                return confirm('Are you sure?');
            }

            //hide popover
            $(':not(#anything)').on('click', function(e) {
                $('.quick-detail').each(function() {
                    //the 'is' for buttons that trigger popups
                    //the 'has' for icons and other elements within a button that triggers a popup
                    if (!$(this).is(e.target) && $(this).has(e.target).length === 0 && $('.popover').has(e.target).length === 0) {
                        $(this).popover('hide');
                        return;
                    }
                });
            });

            $(function() {
                //load ajax
                $("#loading").bind("ajaxStart", function() {
                    $(this).show();
                }).bind("ajaxComplete", function() {
                    $(this).hide();
                });
            });
        </script>

        <script>

            function loadCustomer()
            {
                if ($('#btn-search').attr('value'))
                {
                    setTimeout(function() {
                        $.post('<?php echo $this->createUrl('search/GetListSuggestUser') ?>', {
                            key: $('#btn-search').attr('value'),
                        }, function(data) {
                            if (typeof (data) == 'object') {
                                listSearchCustomers = [];
                                listSearchCustomers = data;
                                show_customer_list();
                            }
                        }, 'json');
                    }, '500');
                }
            }

            function show_customer_list() {
                var str = '';
                if (listSearchCustomers.length > 0) {
                    for (var i = 0; i < listSearchCustomers.length; i++) {
                        str += '<li>';
                        str += '<a href="' + listSearchCustomers[i].viewUrl + '">';
                        str += '<div class="row-fluid">';
                        str += '<div class="span3">';
                        str += '<img src="' + listSearchCustomers[i].photo + '">';
                        str += '</div>';
                        str += '<div class="span9">';
                        str += '<b>';
                        str += listSearchCustomers[i].firstname + ' ' + listSearchCustomers[i].lastname + '</b><br>';
                        str += '<b>'+listSearchCustomers[i].mobile_phone + '</b><br>';
                        str += listSearchCustomers[i].email + '<br>';
                        str += '<span class="badge badge-info">' + listSearchCustomers[i].merchant + '</span><br>';
                        str += '</div>';
                        str += '</div>';
                        str += '</a>';
                        str += '</li>';
                    }
                    str += '<li>';
                    str += '<a href="' + '<?php echo $this->createUrl('customer/create') ?>' + '">';
                    str += '<h2><b>Add New Customer</b></h2>';
                    str += '</a>';
                    str += '</li>';
                }
                else {
                    if ($('#btn-search').attr('value') != '') {
                        str += '<li>There are no customer like ' + "'<b>" + $('#btn-search').attr('value') + "'</b>!" + '</li>';
                    }
                    str += '<li>';
                    str += '<a href="' + '<?php echo $this->createUrl('customer/create') ?>' + '">';
                    str += '<h2><b>Add New Customer</b></h2>';
                    str += '</a>';
                    str += '</li>';
                }

                $(".suggest-list-search").empty().append(str);
                $('.suggest-list-search').slimScroll({
                    position: 'right',
//                    height: '450px',
                    width: '300px',
                    railVisible: true,
                });
            }

            //Hide search customer box
            function hideSuggestCustomer() {
                $('html').click(function(e) {
                    if (e.target.parentElement.className != "suggest-list-search") {
                        _hideSearchbox();
                    }
                });
            }
            function _hideSearchbox()
            {
                $(".suggest-list-search").empty();
                if ($(".suggest-list-search").parent('.slimScrollDiv').size() > 0)
                {
                    $(".suggest-list-search").parent().replaceWith($(".suggest-list-search"));
                    $(".suggest-list-search").attr('style', '');
                }
            }
        </script>
        <!-- end: JavaScript-->

        
        <?php echo Options::getItem("js_google_tracking");?>
        <?php echo Options::getItem("js_zopim_backend");?>
    </body>
</html>
